#include "PortAlloctor.h"
#include <xlib2\thread.h>
#include <xlib2\signal.h>
#include <xlib2\lock.h>

CPortAlloctor::CPortAlloctor()
{
}

CPortAlloctor::~CPortAlloctor()
{
}

void* CPortAlloctor::alloc_signal()
{
	XLIB2::CSignal* p = new XLIB2::CSignal();

	return p; 
}

void CPortAlloctor::set_signal( void* _signal )
{
	XLIB2::CSignal* p = (XLIB2::CSignal*)_signal;
	p->Set();
}

void CPortAlloctor::wait_signal( void* _signal )
{
	XLIB2::CSignal* p = (XLIB2::CSignal*)_signal;
	p->Wait();
}

void CPortAlloctor::free_signal( void* _signal )
{
	XLIB2::CSignal* p = (XLIB2::CSignal*)_signal;
	delete p;
}

void* CPortAlloctor::alloc_mutex()
{
	XLIB2::CXLock* p = new XLIB2::CXLock();

	return p;
}

void CPortAlloctor::lock_mutex( void* _mutex )
{
	XLIB2::CXLock* p = (XLIB2::CXLock*)_mutex;
	p->Lock();
}

void CPortAlloctor::unlock_mutex( void* _mutex )
{
	XLIB2::CXLock* p = (XLIB2::CXLock*)_mutex;
	p->UnLock();
}

void CPortAlloctor::free_mutex( void* _mutex )
{
	XLIB2::CXLock* p = (XLIB2::CXLock*)_mutex;
	delete p;
}

bool CPortAlloctor::create_thread( int (*thread_func)(void*), void* param )
{
	return XLIB2::CThread::CreateThread( thread_func,param );
}
